package personal.leil.learning;

/**
 * 单链表节点
 * <p>
 * 单链表节点代码实现
 * </p>
 *
 * @author Leil
 * @version 1.0
 * @since 2024-1-5
 */
public class SNode {

    /**
     * 指向下一节点的指针
     */
    private SNode next;

    /**
     * 数据域
     */
    private Object data;

    /**
     * Constructor
     *
     * @param data data for node
     */
    public SNode(Object data) {
        this.data = data;
    }

    public Object getData() {
        return data;
    }

    public SNode getNext() {
        return next;
    }

    public SNode setNext(SNode next) {
        this.next = next;
        return next;
    }

    @Override
    public String toString() {
        return getClass().getName() + "@" + Integer.toHexString(hashCode()) + "【" + getData() + "】";
    }
}
